package com.czk.pojo;

import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;

/**
 * Entity 实名实体类
 * Table 配置实体类和表的字段映射关系
 *
 * @Author:ChenZhangKun
 * @Date: 2021/7/1 9:46
 */
@Entity
@Table(name = "cst_customer")
public class Customer {
    @Id
    /**
     * GenerationType.TABLE->jpa提供的一种机制，通过一张数据表的像是帮助我们完成主键自增
     * GenerationType.AUTO->由程序自动的帮我们选择主键生成策略
     */
    // @GeneratedValue(strategy = GenerationType.IDENTITY)// 主键自增，用的的是底层的AutoIncreament方式
    // 自定义主键方式
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "custom-id") // 自定义主键方式
    @GenericGenerator(name = "custom-id", strategy = "com.czk.config.OwnIdGenerator") // 自定义主键方式
    @Column(name = "cust_id")
    private Long userId; // 主键
    @Column(name = "cust_name")
    private String custName; // 名称
    @Column(name = "cust_source")
    private String custSource; // 来源
    @Column(name = "cust_level")
    private String custLevel; // 级别
    @Column(name = "cust_industry")
    private String custIndustry; // 行业
    @Column(name = "cust_phone")
    private String custPhone; //号码
    @Column(name = "cust_address")
    private String custAddress; // 地址

    @Override
    public String toString() {
        return "Customer{" +
                "userId=" + userId +
                ", custName='" + custName + '\'' +
                ", custSource='" + custSource + '\'' +
                ", custLevel='" + custLevel + '\'' +
                ", custIndustry='" + custIndustry + '\'' +
                ", custPhone='" + custPhone + '\'' +
                ", custAddress='" + custAddress + '\'' +
                '}';
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getCustName() {
        return custName;
    }

    public void setCustName(String custName) {
        this.custName = custName;
    }

    public String getCustSource() {
        return custSource;
    }

    public void setCustSource(String custSource) {
        this.custSource = custSource;
    }

    public String getCustLevel() {
        return custLevel;
    }

    public void setCustLevel(String custLevel) {
        this.custLevel = custLevel;
    }

    public String getCustIndustry() {
        return custIndustry;
    }

    public void setCustIndustry(String custIndustry) {
        this.custIndustry = custIndustry;
    }

    public String getCustPhone() {
        return custPhone;
    }

    public void setCustPhone(String custPhone) {
        this.custPhone = custPhone;
    }

    public String getCustAddress() {
        return custAddress;
    }

    public void setCustAddress(String custAddress) {
        this.custAddress = custAddress;
    }
}
